home *** CD-ROM | disk | FTP | other *** search
/ Core Concepts in Art 2 / Core Concepts in Art (Frames of Reference)(The McGraw-Hill Companies)(2004).iso / mac / media / main.swf / scripts / frame_1 / DoAction.as < prev   
Text File  |  2003-11-02  |  15KB  |  551 lines

  1. function hideTitles(except)
  2. {
  3.    var i = 0;
  4.    while(i < 13)
  5.    {
  6.       if(i < except || i > except)
  7.       {
  8.          this[optionsArray[i] + "Title_mc"]._visible = 0;
  9.       }
  10.       this[optionsArray[except] + "Title_mc"]._visible = 1;
  11.       i++;
  12.    }
  13. }
  14. function hideMenus(except1, except2)
  15. {
  16.    var i = 0;
  17.    while(i < 4)
  18.    {
  19.       if(i == except1 || i == except2)
  20.       {
  21.          this[menuArray[i]]._visible = 1;
  22.       }
  23.       else
  24.       {
  25.          this[menuArray[i]]._visible = 0;
  26.       }
  27.       i++;
  28.    }
  29. }
  30. function hideLayer(except)
  31. {
  32.    var i = 0;
  33.    while(i < 7)
  34.    {
  35.       if(i == except)
  36.       {
  37.          this[layerArray[i]]._visible = 1;
  38.       }
  39.       else
  40.       {
  41.          this[layerArray[i]]._visible = 0;
  42.       }
  43.       i++;
  44.    }
  45. }
  46. function disableButton(whichMenu, whichButton)
  47. {
  48.    i = 0;
  49.    while(i < menuArray.length)
  50.    {
  51.       j = 0;
  52.       while(j < optionsArray.length)
  53.       {
  54.          if(i == whichMenu && j == whichButton)
  55.          {
  56.             this[menuArray[i]][optionsArray[j] + "_btn"]._visible = 0;
  57.             this[menuArray[i]][optionsArray[j] + "Img_mc"]._alpha = 30;
  58.             this[menuArray[i]][optionsArray[j] + "_txt"]._alpha = 40;
  59.          }
  60.          else
  61.          {
  62.             this[menuArray[i]][optionsArray[j] + "_btn"]._visible = 1;
  63.             this[menuArray[i]][optionsArray[j] + "Img_mc"]._alpha = 80;
  64.             this[menuArray[i]][optionsArray[j] + "_txt"]._alpha = 100;
  65.          }
  66.          j++;
  67.       }
  68.       i++;
  69.    }
  70. }
  71. function loadLayer(whichLayer)
  72. {
  73.    pleaseSave_mc._visible = 0;
  74.    ph._visible = 0;
  75.    makeLarge();
  76.    this[whichLayer + "_mc"]._visible = 1;
  77.    link1_mc._y = 525;
  78.    if(whichLayer == "newOpen")
  79.    {
  80.       hideTitles(11);
  81.       hideLayer(0);
  82.       hideMenus(1,3);
  83.       link1_mc._y = 553;
  84.       disableButton(4,4);
  85.    }
  86.    else if(whichLayer == "new")
  87.    {
  88.       checkForAnotherFile("new");
  89.       hideTitles(6);
  90.       hideLayer(1);
  91.       hideMenus(1,3);
  92.       link1_mc._y = 553;
  93.       disableButton(3,6);
  94.    }
  95.    else if(whichLayer == "open")
  96.    {
  97.       checkForAnotherFile("open");
  98.       hideTitles(7);
  99.       hideLayer(2);
  100.       hideMenus(1,3);
  101.       link1_mc._y = 553;
  102.       disableButton(3,7);
  103.    }
  104.    else if(whichLayer == "save")
  105.    {
  106.       hideTitles(10);
  107.       hideLayer(3);
  108.       link1_mc._y = 553;
  109.       hideMenus(1,3);
  110.       disableButton(3,10);
  111.    }
  112.    else if(whichLayer == "print")
  113.    {
  114.       hideTitles(8);
  115.       hideLayer(4);
  116.       hideMenus(1,3);
  117.       link1_mc._y = 553;
  118.       disableButton(3,8);
  119.    }
  120.    else if(whichLayer == "sawyer")
  121.    {
  122.       hideTitles(11);
  123.       hideLayer(6);
  124.       hideMenus(0,3);
  125.       disableButton(4,4);
  126.    }
  127.    else if(whichLayer == "start")
  128.    {
  129.       hideTitles(11);
  130.       hideLayer(5);
  131.       hideMenus(4,4);
  132.       disableButton(4,4);
  133.       whereFrom = undefined;
  134.    }
  135.    checkForVariables();
  136. }
  137. function loadPage(whichSWF)
  138. {
  139.    pleaseSave_mc._visible = 0;
  140.    ph._visible = 1;
  141.    link1_mc._y = 525;
  142.    hideLayer(6);
  143.    loadMovie(whichSWF + ".swf","ph");
  144.    whereFrom = whichSWF;
  145.    if(whichSWF == "create")
  146.    {
  147.       hideTitles(0);
  148.       hideMenus(2,3);
  149.       link1_mc._y = 553;
  150.       link1_mc._visible = 1;
  151.       disableButton(2,0);
  152.       makeLarge();
  153.    }
  154.    else if(whichSWF == "delete")
  155.    {
  156.       hideTitles(1);
  157.       hideMenus(2,3);
  158.       link1_mc._y = 553;
  159.       link1_mc._visible = 1;
  160.       disableButton(2,1);
  161.       makeLarge();
  162.    }
  163.    else if(whichSWF == "generator")
  164.    {
  165.       hideTitles(2);
  166.       hideMenus(1,3);
  167.       disableButton(1,2);
  168.       makeSmall();
  169.    }
  170.    else if(whichSWF == "guess")
  171.    {
  172.       hideTitles(3);
  173.       hideMenus(1,3);
  174.       disableButton(1,3);
  175.       makeSmall();
  176.    }
  177.    else if(whichSWF == "help")
  178.    {
  179.       hideTitles(4);
  180.       hideMenus(1,3);
  181.       disableButton(1,4);
  182.       makeSmall();
  183.    }
  184.    else if(whichSWF == "modify")
  185.    {
  186.       hideTitles(5);
  187.       hideMenus(2,3);
  188.       link1_mc._y = 553;
  189.       link1_mc._visible = 1;
  190.       disableButton(2,5);
  191.       makeLarge();
  192.    }
  193.    else if(whichSWF == "print")
  194.    {
  195.       hideTitles(8);
  196.       hideMenus(1,3);
  197.       link1_mc._y = 553;
  198.       disableButton(3,8);
  199.       makeLarge();
  200.    }
  201.    else if(whichSWF == "quiz")
  202.    {
  203.       hideTitles(9);
  204.       hideMenus(1,3);
  205.       link1_mc._y = 553;
  206.       disableButton(1,9);
  207.       makeLarge();
  208.    }
  209.    else if(whichSWF == "sawyer")
  210.    {
  211.       hideTitles(11);
  212.       hideMenus(1,3);
  213.       disableButton(1,11);
  214.       makeSmall();
  215.    }
  216.    else if(whichSWF == "search")
  217.    {
  218.       calculateChapterImages();
  219.       hideTitles(12);
  220.       hideMenus(1,3);
  221.       disableButton(1,12);
  222.       makeSmall();
  223.    }
  224.    checkForVariables();
  225. }
  226. function makeSmall()
  227. {
  228.    bevel_mc._height = 340;
  229. }
  230. function makeLarge()
  231. {
  232.    bevel_mc._height = 375;
  233. }
  234. function doRollOver(whichMovieClip, whichButton)
  235. {
  236.    this[whichMovieClip + "_mc"][whichButton + "Img_mc"]._alpha = 100;
  237.    textColor = new Color(eval(whichMovieClip + "_mc." + whichButton + "_txt"));
  238.    if(whichMovieClip == "link1" && outterLinkRollColor != undefined || whichMovieClip == "link2" && outterLinkRollColor != undefined || whichMovieClip == "link3" && outterLinkRollColor != undefined)
  239.    {
  240.       textColor.setRGB(outterLinkRollColor);
  241.    }
  242.    else
  243.    {
  244.       textColor.setRGB(rollColor);
  245.    }
  246.    getUrl("lingo: cursor 280", "");
  247. }
  248. function doRollOut(whichMovieClip, whichButton)
  249. {
  250.    if(this[whichMovieClip + "_mc"][whichButton + "_btn"]._visible == 1)
  251.    {
  252.       this[whichMovieClip + "_mc"][whichButton + "Img_mc"]._alpha = 75;
  253.    }
  254.    if(whichMovieClip == "link1" && outterLinkRestColor != undefined || whichMovieClip == "link2" && outterLinkRestColor != undefined || whichMovieClip == "link3" && outterLinkRestColor != undefined)
  255.    {
  256.       textColor.setRGB(outterLinkRestColor);
  257.    }
  258.    else
  259.    {
  260.       textColor.setRGB(restColor);
  261.    }
  262.    getUrl("lingo: cursor -1", "");
  263. }
  264. function simpleRollOver()
  265. {
  266.    getUrl("lingo: cursor 280", "");
  267. }
  268. function simpleRollOut()
  269. {
  270.    getUrl("lingo: cursor -1", "");
  271. }
  272. function seperatePath()
  273. {
  274.    fileLoc.toString();
  275.    var isItPC = fileLoc.indexOf("\\");
  276.    if(isItPC != -1)
  277.    {
  278.       whereToCut = fileLoc.lastIndexOf("\\");
  279.       masterFileName = fileLoc.slice(whereToCut + 1,fileLoc.length);
  280.       filePath = fileLoc.slice(0,whereToCut + 1);
  281.    }
  282.    else
  283.    {
  284.       whereToCut = fileLoc.lastIndexOf(":");
  285.       masterFileName = fileLoc.slice(whereToCut + 1,fileLoc.length);
  286.       filePath = fileLoc.slice(0,whereToCut + 1);
  287.    }
  288.    originalFileLoc = fileLoc;
  289.    originalMasterFileName = undefined;
  290.    originalFilePath = undefined;
  291. }
  292. function tempPath()
  293. {
  294.    fileLoc.toString();
  295.    var isItPC = fileLoc.indexOf("\\");
  296.    if(isItPC != -1)
  297.    {
  298.       whereToCut = fileLoc.lastIndexOf("\\");
  299.       originalMasterFileName = masterFileName;
  300.       masterFileName = fileLoc.slice(whereToCut + 1,fileLoc.length);
  301.       originalFilePath = filePath;
  302.       filePath = fileLoc.slice(0,whereToCut + 1);
  303.    }
  304.    else
  305.    {
  306.       whereToCut = fileLoc.lastIndexOf(":");
  307.       originalMasterFileName = masterFileName;
  308.       masterFileName = fileLoc.slice(whereToCut + 1,fileLoc.length);
  309.       originalFilePath = filePath;
  310.       filePath = fileLoc.slice(0,whereToCut + 1);
  311.    }
  312. }
  313. function resetFileLoc()
  314. {
  315.    if(originalFilePath != undefined)
  316.    {
  317.       fileLoc = originalFileLoc;
  318.       seperatePath();
  319.    }
  320. }
  321. function checkForVariables()
  322. {
  323.    resetFileLoc();
  324.    if(generatorArray == undefined || generatorArray.length == 0)
  325.    {
  326.       i = 0;
  327.       while(i < menuArray.length)
  328.       {
  329.          j = 0;
  330.          while(j < optionsArray.length)
  331.          {
  332.             if(this[menuArray[i]][optionsArray[j] + "_btn"]._visible == 1)
  333.             {
  334.                if(i == 0 && j == 9 || i == 1 && j == 9 || i == 2 && j == 1 || i == 2 && j == 5 || i == 3 && j == 8)
  335.                {
  336.                   this[menuArray[i]][optionsArray[j] + "_btn"]._visible = 0;
  337.                   this[menuArray[i]][optionsArray[j] + "Img_mc"]._alpha = 35;
  338.                   this[menuArray[i]][optionsArray[j] + "_txt"]._alpha = 60;
  339.                }
  340.                else
  341.                {
  342.                   this[menuArray[i]][optionsArray[j] + "_btn"]._visible = 1;
  343.                   this[menuArray[i]][optionsArray[j] + "Img_mc"]._alpha = 75;
  344.                   this[menuArray[i]][optionsArray[j] + "_txt"]._alpha = 100;
  345.                }
  346.             }
  347.             j++;
  348.          }
  349.          i++;
  350.       }
  351.    }
  352.    else
  353.    {
  354.       i = 0;
  355.       while(i < menuArray.length)
  356.       {
  357.          j = 0;
  358.          while(j < optionsArray.length)
  359.          {
  360.             if(this[menuArray[i]][optionsArray[j] + "_btn"]._visible == 1)
  361.             {
  362.                this[menuArray[i]][optionsArray[j] + "_btn"]._visible = 1;
  363.                this[menuArray[i]][optionsArray[j] + "Img_mc"]._alpha = 80;
  364.                this[menuArray[i]][optionsArray[j] + "_txt"]._alpha = 100;
  365.             }
  366.             j++;
  367.          }
  368.          i++;
  369.       }
  370.    }
  371. }
  372. function help()
  373. {
  374.    if(ph._visible == 1)
  375.    {
  376.       if(whichSWF != "create")
  377.       {
  378.          if(whichSWF != "delete")
  379.          {
  380.             if(whichSWF != "generator")
  381.             {
  382.                if(whichSWF != "guess")
  383.                {
  384.                   if(whichSWF != "help")
  385.                   {
  386.                      if(whichSWF != "modify")
  387.                      {
  388.                         if(whichSWF != "print")
  389.                         {
  390.                            if(whichSWF != "quiz")
  391.                            {
  392.                               if(whichSWF != "sawyer")
  393.                               {
  394.                                  if(whichSWF == "search")
  395.                                  {
  396.                                  }
  397.                               }
  398.                            }
  399.                         }
  400.                      }
  401.                   }
  402.                }
  403.             }
  404.          }
  405.       }
  406.    }
  407.    else if(ph._visible == 0)
  408.    {
  409.       if(whichLayer != "newOpen")
  410.       {
  411.          if(whichLayer != "new")
  412.          {
  413.             if(whichLayer != "open")
  414.             {
  415.                if(whichLayer != "save")
  416.                {
  417.                   if(whichLayer != "print")
  418.                   {
  419.                      if(whichLayer != "sawyer")
  420.                      {
  421.                         if(whichLayer == "start")
  422.                         {
  423.                         }
  424.                      }
  425.                   }
  426.                }
  427.             }
  428.          }
  429.       }
  430.    }
  431. }
  432. function createArray(whichArray, whatToBecome)
  433. {
  434.    var count = 0;
  435.    if(_root[whatToBecome] == undefined)
  436.    {
  437.       _root[whatToBecome] = new Array();
  438.       _root.flashcardArray = new Array();
  439.    }
  440.    i = 0;
  441.    while(i < 40)
  442.    {
  443.       this["chap" + i] = new Array();
  444.       this["altChap" + i] = new Array();
  445.       i++;
  446.    }
  447.    i = 0;
  448.    while(i < refineMasterFile_mc.arrayFromGenerator.length)
  449.    {
  450.       if(refineMasterFile_mc.arrayFromGenerator.charAt(i) == "\"" && refineMasterFile_mc.arrayFromGenerator.charAt(i + 1) != "," && refineMasterFile_mc.arrayFromGenerator.charAt(i + 1) != "]")
  451.       {
  452.          if(refineMasterFile_mc.arrayFromGenerator.charAt(i + 1) == "\"")
  453.          {
  454.             this["chap" + count] = "";
  455.             this["altChap" + count] = "";
  456.          }
  457.          else
  458.          {
  459.             stop = 0;
  460.             j = i + 1;
  461.             while(j < refineMasterFile_mc.arrayFromGenerator.length)
  462.             {
  463.                if(refineMasterFile_mc.arrayFromGenerator.charAt(j) != "\"" && stop != 1)
  464.                {
  465.                   if(refineMasterFile_mc.arrayFromGenerator.charAt(j) != ",")
  466.                   {
  467.                      if(refineMasterFile_mc.arrayFromGenerator.charAt(j + 1) != "," && refineMasterFile_mc.arrayFromGenerator.charAt(j + 1) != "\"")
  468.                      {
  469.                         this["chap" + count].push(refineMasterFile_mc.arrayFromGenerator.charAt(j) + refineMasterFile_mc.arrayFromGenerator.charAt(j + 1));
  470.                         this["altChap" + count].push(refineMasterFile_mc.arrayFromGenerator.charAt(j) + refineMasterFile_mc.arrayFromGenerator.charAt(j + 1));
  471.                         j += 1;
  472.                      }
  473.                      else
  474.                      {
  475.                         this["chap" + count].push(refineMasterFile_mc.arrayFromGenerator.charAt(j));
  476.                         this["altChap" + count].push(refineMasterFile_mc.arrayFromGenerator.charAt(j));
  477.                      }
  478.                   }
  479.                }
  480.                else if(refineMasterFile_mc.arrayFromGenerator.charAt(j) == "\"" && stop != 1)
  481.                {
  482.                   var numberOfSlots = this["chap" + count][0];
  483.                   this["chap" + count].shift();
  484.                   this["chap" + count].sort(numerical);
  485.                   findWhatsMissing(numberOfSlots,this["chap" + count]);
  486.                   stop = 1;
  487.                }
  488.                j++;
  489.             }
  490.          }
  491.          _root[whatToBecome].push(this["chap" + count]);
  492.          _root.flashcardArray.push(this["altChap" + count]);
  493.          count++;
  494.       }
  495.       i++;
  496.    }
  497.    loading_mc._visible = 0;
  498.    getUrl("lingo: cursor -1", "");
  499.    if(whereFrom != undefined)
  500.    {
  501.       loadPage(whereFrom);
  502.    }
  503.    else
  504.    {
  505.       loadLayer("sawyer");
  506.    }
  507. }
  508. function findWhatsMissing(theNumber, theArray)
  509. {
  510.    if(questionsWithImages == undefined)
  511.    {
  512.       questionsWithImages = new Array();
  513.       questionsWithImages.push("");
  514.    }
  515.    var tempNumHolder = new Array();
  516.    var k = 1;
  517.    while(k <= theNumber)
  518.    {
  519.       tempNumHolder.push(k);
  520.       var l = 0;
  521.       while(l < theArray.length)
  522.       {
  523.          if(k == theArray[l])
  524.          {
  525.             tempNumHolder.pop();
  526.          }
  527.          l++;
  528.       }
  529.       k++;
  530.    }
  531.    questionsWithImages.push(tempNumHolder);
  532. }
  533. function numerical(element1, element2)
  534. {
  535.    return element1 - element2;
  536. }
  537. function checkForAnotherFile(whichSection)
  538. {
  539.    if(generatorArray != undefined)
  540.    {
  541.       pleaseSave_mc._visible = 1;
  542.       this[whichSection + "Page_mc"].cancel_btn._visible = 0;
  543.       this[whichSection + "Page_mc"].browse_btn._visible = 0;
  544.       this[whichSection + "Page_mc"].ok_btn._visible = 0;
  545.    }
  546. }
  547. system.useCodepage = true;
  548. var menuArray = new Array("link0_mc","link1_mc","link2_mc","link3_mc");
  549. var optionsArray = new Array("create","delete","generator","guess","help","modify","new","open","print","quiz","save","sawyer","search");
  550. var layerArray = new Array("newOpenPage_mc","newPage_mc","openPage_mc","savePage_mc","printPage_mc","start_mc");
  551.